package com.javafly.sms.service.cms;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springside.modules.orm.Page;
import org.springside.modules.orm.PropertyFilter;
import org.springside.modules.security.springsecurity.SpringSecurityUtils;

import com.javafly.sms.dao.cms.StestDao;
import com.javafly.sms.dao.security.AuthorityDao;
import com.javafly.sms.dao.security.ResourceDao;
import com.javafly.sms.dao.security.RoleDao;
import com.javafly.sms.dao.security.UserDao;
import com.javafly.sms.entity.cms.Stest;
import com.javafly.sms.entity.security.Authority;
import com.javafly.sms.entity.security.Resource;
import com.javafly.sms.entity.security.Role;
import com.javafly.sms.entity.security.User;
import com.javafly.sms.service.ServiceException;

/**
 * cms类.
 * 
 * @author hym
 */
// Spring Service Bean的标识.
@Service
// 默认将类中的所有函数纳入事务管理.
@Transactional
public class CmsEntityManager {

	private static Logger logger = LoggerFactory.getLogger(CmsEntityManager.class);

	@Autowired
	private StestDao stestDao;
	
	//-- stest Manager --//
	@Transactional(readOnly = true)
	public Stest getStest(Long id) {
		return stestDao.get(id);
	}

	public void saveStest(Stest entity) {
		stestDao.save(entity);
	}
	
	/**
	 * 删除用户,如果尝试删除超级管理员将抛出异常.
	 */
	public void deleteStest(Long id) {
		stestDao.delete(id);
	}
	
	/**
	 * 使用属性过滤条件查询用户.
	 */
	@Transactional(readOnly = true)
	public Page<Stest> searchStest(final Page<Stest> page, final List<PropertyFilter> filters) {
		return stestDao.findPage(page, filters);
	}

	@Transactional(readOnly = true)
	public List<Stest> getAllStest() {
		return stestDao.getAll();
	}

	
	
}
